function check() {
    if(document.getElementsByName("name")[0].value == "") {
        document.getElementsByName("errormsg")[0].innerText = "Name should not be null."
        return false;
    }
    if(document.getElementsByName("word")[0].value == "") {
        document.getElementsByName("errormsg")[0].innerText = "Description should not be null."
        return false;
    }
    return true;
}

function checkAdd() {
    if(document.getElementsByName("productId")[0].value == "") {
        document.getElementsByName("errormsg")[0].innerText = "Product Id should not be null."
        return false;
    }
    if(document.getElementsByName("name")[0].value == "") {
        document.getElementsByName("errormsg")[0].innerText = "Name should not be null."
        return false;
    }if(document.getElementsByName("file")[0].value == "") {
        document.getElementsByName("errormsg")[0].innerText = "Image should not be null."
        return false;
    }
    if(document.getElementsByName("word")[0].value == "") {
        document.getElementsByName("errormsg")[0].innerText = "Description should not be null."
        return false;
    }
    return true;
}

function checkImg() {
    if(document.getElementsByName("file")[0].value == "") {
        document.getElementsByName("errormsg")[0].innerText = "Image should not be null."
        return false;
    }
    return true;
}